<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<link href="css/base.css?v=20140103" rel="stylesheet" type="text/css" />
<title></title>
</head>
<style>

</style>
<body>
<div class="viewport" id="main_content"/>

<script type="text/javascript" src="js/jquery-1.8.1.min.js"></script>
<script type="text/javascript" src="js/handlebars-v1.2.0.js"></script>

<script id="showtype_1" type="text/x-handlebars-template">
 <table class="tab">
	{{#each SaleList}}
    <tr>
    	<td width="1%" align="left" nowrap="nowrap">
        	<b>部门名称:</b>
        </td>
        <td align="left" >
        	{{DeptName}}
        </td>
        <td  width="1%" align="left" nowrap="nowrap">
        	<b>销售金额:</b>
        </td>
        <td align="left" >
        	¥{{SaleMoney}}
        </td>
    </tr>
    
    <tr>
    	<td  align="left" nowrap="nowrap">
        	<b>折扣金额:</b>
        </td>
        <td align="left" >
        	¥{{DiscMoney}}
        </td>
        <td  align="left" nowrap="nowrap">
        	<b>优惠金额:</b>
        </td>
        <td align="left" >
        	¥{{PreferentialMoney}}
        </td>
    </tr>

	<tr><td colspan=4><div style="overflow:hidden;background:gray;height:1px;"></div></td></tr>

{{/each}}
    
</table>



</script>

<script id="showtype_2" type="text/x-handlebars-template">
 <table class="tab">
	{{#each SaleList}}
    <tr>
    	<td width="1%" align="left" nowrap="nowrap">
        	<b>商品代码:</b>
        </td>
        <td align="left" >
        	{{GoodsCode}}
        </td>
        <td  width="1%" align="left" nowrap="nowrap">
        	<b>商品名称:</b>
        </td>
        <td align="left" >
        	{{GoodsName}}
        </td>
    </tr>
    
    <tr>
    	<td  align="left" nowrap="nowrap">
        	<b>商品规格:</b>
        </td>
        <td align="left" >
        	{{GoodsSpec}}
        </td>
        <td  align="left" nowrap="nowrap">
        	<b>零售单价:</b>
        </td>
        <td align="left" >
        	¥{{Price}}
        </td>
    </tr>
	<tr>
    	<td  align="left" nowrap="nowrap">
        	<b>销售数量:</b>
        </td>
        <td align="left" >
        	{{SaleCount}}
        </td>
        <td  align="left" nowrap="nowrap">
        	<b>折扣金额:</b>
        </td>
        <td align="left" >
        	¥{{DiscountMoney}}
        </td>
    </tr>
	<tr>
    	<td  align="left" nowrap="nowrap">
        	<b>优惠金额:</b>
        </td>
        <td align="left" >
        	¥{{PreferentialMoney}}
        </td>
        <td  align="left" nowrap="nowrap">
        	<b>销售金额:</b>
        </td>
        <td align="left" >
        	¥{{SaleMoney}}
        </td>
    </tr>
	<tr><td colspan=4><div style="overflow:hidden;background:gray;height:1px;"></div></td></tr>

{{/each}}
    
</table>
</script>



<script type="text/javascript">

	   var showtype=window.android.showtype();
	   var source=null;
		
	   var context = null;
	   
	   if ('1'==showtype){
	      source=$("#showtype_1").html();
	      context =  {"SaleList":[{"DeptId":"01010402","DeptName":"超市一","SaleMoney":209,"DiscMoney":0,"PreferentialMoney":19,"SuspendMoney":0,"CostMoney":0,"BalanceMoney":0},{"DeptId":"01010404","DeptName":"超市三","SaleMoney":77.4,"DiscMoney":0,"PreferentialMoney":0,"SuspendMoney":0,"CostMoney":0,"BalanceMoney":0},{"DeptId":"01010702","DeptName":"男装二","SaleMoney":2500,"DiscMoney":0,"PreferentialMoney":0,"SuspendMoney":0,"CostMoney":0,"BalanceMoney":0},{"DeptId":"01011201","DeptName":"备用","SaleMoney":478,"DiscMoney":0,"PreferentialMoney":0,"SuspendMoney":0,"CostMoney":0,"BalanceMoney":0}],"Result":"1","Message":""};
	   }
       var template = Handlebars.compile(source);
	   eval( ' context=' + window.android.getjson() );

	   if ( context.Result==0)
	   {
		   alert( context.Message );
	   }else{
		   var html = template( context );
	       $("#main_content").html( html );   
	   }
</script>

</body>
</html>
